{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3cd6a59f",
   "metadata": {},
   "source": [
    "**定义 7.1**： 一个**偏微分方程(PDE)** 是由一个有两个或更多变量的函数和它的偏导组成的方程 .\n",
    "\n",
    "**定义7.2**：**拉普拉斯方程** 是一个形如\n",
    "$$\\Delta u(x)=0\\tag{7.1}\\label{laplacian equation}$$\n",
    "的二阶PDE,其中$u:\\bar{\\Omega}\\rightarrow\\mathbb{R}$, $\\bar{\\Omega}$是开集$\\Omega\\in\\mathbb{R}^n$的闭包.\n",
    "我们定义**拉普拉斯算子** $\\Delta:\\mathcal{C}^2(\\Omega)\\rightarrow \\mathcal{C}(\\Omega)$:\n",
    "$$\\Delta:=\\sum\\limits_{i=1}^n\\frac{\\partial^2}{\\partial x_i^2}.\\tag{7.2}\\label{laplacian operator}$$\n",
    "\n",
    "**定义7.4**：**泊松方程(位势方程)** 是一个形如\n",
    "$$-\\Delta u(x)=f(x)\\tag{7.4}\\label{Possion equation}$$\n",
    "的二阶PDE,其中未知量是函数$u:\\bar{\\Omega}\\rightarrow\\mathbb{R}$, $\\bar{\\Omega}$是开集$\\Omega\\in\\mathbb{R}^n$的闭包,右端项$f:\\Omega\\rightarrow \\mathbb{R}$是一个预先给定的函数.\n",
    "\n",
    "**评论7.1**: 在泊松方程的左端我们添加负号使得该方程成为一个椭圆方程(二阶导数$\\frac{\\partial}{\\partial x_i\\partial x_j}$的系数$a_{ij}$构成的矩阵A特征值全为负.)当我们施加中心有限差分离散该算子后,系数矩阵是一个正定阵,这在后面系数矩阵的特征值中可以看出.\n",
    "\n",
    "**定义7.5**: 一个**边值问题(BVP)** 是一个带有边界条件的微分方程,边界条件只施加在计算域的边界上.\n",
    "\n",
    "**评论7.2**: 给定边界上方程的导数值和函数值,我们找到边界上未知函数值处和计算域$\\Omega$上的函数值.\n",
    "\n",
    "**定义7.6**: 一维情况下,计算域$\\Omega=(a, b)$,一般边界条件有以下几种:\n",
    "\n",
    "   - **迪利克雷边界条件**: 给定$u(a)=\\alpha$和$u(b)=\\beta$.\n",
    "   - **纽曼边界条件**: 给定$\\frac{\\partial u}{\\partial x}\\lvert_a=\\alpha$和$\\frac{\\partial u}{\\partial x}\\lvert_b=\\beta$.\n",
    "   - **混合边界条件**: 形如给定$u(a)=\\alpha$和$\\frac{\\partial u}{\\partial x}\\lvert_b=\\beta$."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d0e1c33c",
   "metadata": {},
   "source": [
    "# 有限差分方法(Finite Difference Method)\n",
    "\n",
    "**公式7.8**: 数值求解线性边值问题时,一个一般的有限差分方法的计算过程如下：\n",
    "\n",
    "   1. 使用一个网格离散计算域\n",
    "   1. 使用有限差分离散每一个空间导数,得到一个线性的系统$A\\mathbf{U}=\\mathbf{F}$,其中$\\mathbf{U}$是所有网格点上的函数值组成的向量,$\\mathbf{F}$是网格点上边界条件取值组成的向量.\n",
    "   1. 对该线性系统进行求解,得到网格点上的函数值.\n",
    "   \n",
    "**例7.9**(在单位线段上使用有限差分离散泊松方程):\n",
    "\n",
    "我们有一个一维泊松方程\n",
    "$$- u''(x)=f(x)\\ in\\ \\Omega:=(0, 1),\\tag{7.6}\\label{1d possion equation}$$\n",
    "和边界条件\n",
    "$$u(0)=\\alpha,\\ u(1)=\\beta.\\tag{7.7}\\label{diri bc of 1d possion equation}$$\n",
    "有限差分计算过程如下：\n",
    "\n",
    "   1. 使用规则步长$h$将计算域进行离散,\n",
    "    $$x_j=jh,\\ h=\\frac{1}{m + 1},\\ j=0,1,\\ldots,m+1.$$\n",
    "    设置$U_0=\\alpha$, $U_{m+1}=\\beta$.我们需要计算网格点$x_1,\\ldots,x_m$上函数值$u(x_j)$的近似值$U_j$.\n",
    "   1. 使用二阶中心差分离散近似二阶导数$u''$\n",
    "   $$u''(x_j)=\\frac{u(x_{j-1}) - 2u(x_j) + u(x_{j+1})}{h^2} + \\mathrm{O}(h^2).\\tag{7.8}\\label{FD for 1d laplacian}$$\n",
    "   因此我们得到一个线性系统：\n",
    "   \\begin{align}\n",
    "   -\\frac{\\alpha - 2U_1+ U_2}{h^2}&=f(x_1),\\\\\n",
    "   -\\frac{U_{j - 1} - 2U_j + U_{j+1}}{h^2}&=f(x_j),\\ j=1,\\ldots,m-1,\\\\\n",
    "   -\\frac{U_{m-1} - 2U_m+U_{m+1}}{h^2}&=f(x_m).\\\\\n",
    "   \\end{align}\n",
    "   将它写成一个线性方程组：\n",
    "   $$A\\mathbf{U}=\\mathbf{F},\\tag{7.9}\\label{1d possion linear form}$$\n",
    "   其中我们将已知的边界条件移动到右端,因此有\n",
    "   $$\\mathbf{U}=\n",
    "   \\left[\n",
    "   \\begin{array}{c}\n",
    "       U_1\\\\\n",
    "       U_2\\\\\n",
    "       \\vdots\\\\\n",
    "       U_{m-1}\\\\\n",
    "       U_m\n",
    "   \\end{array}\n",
    "   \\right],\\ \n",
    "   \\mathbf{F}=\n",
    "   \\left[\n",
    "   \\begin{array}{c}\n",
    "       f(x_1) + \\frac{\\alpha}{h^2}\\\\\n",
    "       f(x_2)\\\\\n",
    "       \\vdots\\\\\n",
    "       f(x_{m-1})\\\\\n",
    "       f(x_m) + \\frac{\\beta}{h^2}\\\\\n",
    "   \\end{array}\n",
    "   \\right],\\tag{7.10}$$\n",
    "   $$\n",
    "   A=\\frac{1}{h^2}\n",
    "   \\left[\n",
    "   \\begin{array}{ccccc}\n",
    "   2&-1&&&\\\\\n",
    "   -1&2&-1&&\\\\\n",
    "   &\\ddots&\\ddots&\\ddots&&\\\\\n",
    "   &&-1&2&1\\\\\n",
    "   &&&-1&2\\\\\n",
    "   \\end{array}\n",
    "   \\right].\\tag(7.11)\n",
    "   $$\n",
    "   1. 求解该线性系统(\\ref{1d possion linear form})."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d3b5313",
   "metadata": {},
   "source": [
    "# 误差和适定性\n",
    "**定义7.10** 使用有限差分方法由公式(7.8)计算得到的**全局误差(global error)或计算误差?(solution error)** 是\n",
    "$$\\mathbf{E}=\\mathbf{U}-\\hat{\\mathbf{U}},\\tag{7.12}\\label{solution error}$$\n",
    "其中$\\hat{\\mathbf{U}}=[u(x_1),u(x_2),\\ldots，u(x_m)]^T$是精确解在网格点上的函数值组成的向量,$\\mathbf{U}$是计算结果.\n",
    "\n",
    "**评论7.3**: 7.10的定义方式是因为我们将误差看作是计算解关于真解的差是多少.\n",
    "\n",
    "在衡量误差时，我们需要定义一个范数.我们可不可以直接使用向量范数？\n",
    "\n",
    "0-范数是合理的,它表示网格点上误差最大是多少.\n",
    "\n",
    "那1范数呢？假如精确解就是0，我们使用$2n$个网格进行计算，所有点上的计算结果都是$\\frac{1}{2n}$,显然通过加细网格结果在往真解收敛,我们的计算结果是成功的(虽然没有二阶).通过计算我们知道$\\lVert\\mathbf{E}\\rVert=1$,误差不随着网格加细而下降？这是因为随着加细网格,向量的大小也在增加,我们不能从一个向量的角度来看这个误差,我们需要将误差看做是一个函数，它的取值被限定在了网格上.\n",
    "\n",
    "**定义7.11**：一个**网格函数**是一个作用在有限个点组成的离散网格$\\mathbf{X}$上的函数$\\mathbf{g}:\\mathbf{X}\\rightarrow \\mathbb{R}$.\n",
    "\n",
    "**定义7.12**: 在网格$\\mathbf{X}:=\\{x_1,x_2,\\ldots,x_N\\}$上的网格函数$\\mathbf{g}$的**q-范数**是\n",
    "$$\\lVert\\mathbf{g}\\rVert_q=\\left(h\\sum\\limits_{i=1}^N\\lvert g_i\\rvert^q\\right)^{\\frac{1}{q}},\\tag{7.13}\\label{q-norm of grid func}$$\n",
    "其中$\\mathbf{g}=(g_1,g_2,\\ldots,g_N).$ **无穷范数**定义为\n",
    "$$\\lVert \\mathbf{g}\\rVert_{\\infty}=\\max\\limits_{1\\leq i\\leq N}\\lvert g_i\\rvert.\\tag{7.15}\\label{inf-norm of grid func}$$\n",
    "\n",
    "**评论7.4**: 通过定义网格函数的范数，我们可以来衡量误差的大小和网格加密后计算方法的收敛速度.在数值计算中我们得到一个数值结果$U$,它在网格点上取值,我们可以把它看作是一个函数,同时我们有问题的精确解u.我们得到的离散误差$E$就是函数$U-u$在网格点上的取值,我们也将$E$看作是一个函数,当我们使用定义7.12中的范数来衡量$E$的大小时,我们实际上是使用网格点上的值来近似函数$E$在计算域内的函数范数值,即\n",
    "$$\\lVert \\mathbf{E}\\rVert_q\\approx \\left(\\int_a^b \\lvert E(x)\\rvert^q\\right)^{\\frac{1}{q}}.$$\n",
    "\n",
    "**定义7.14**: 一个有限差分方法的**局部截断误差(local truncation error(LTE))** 是离散连续导数时引入的误差.\n",
    "\n",
    "**引理7.16**:例7.9中的局部截断误差是使用精确解来计算式(7.9)所引入的误差,即\n",
    "$$\\mathbf{\\tau}=A\\hat{\\mathbf{U}}-\\mathbf{F},$$\n",
    "其中$\\hat{\\mathbf{U}}$是精确解所构成的向量.\n",
    "\n",
    "证明:由方程$\\Delta u=f$,将$\\mathbf{F}$的元素替换为$\\Delta u(x_i)$即可.\n",
    "\n",
    "**引理7.17**:局部截断误差和全局误差有关系式\n",
    "$$A\\mathbf{E}=-\\mathbf{\\tau}.\\tag{7.19}$$\n",
    "\n",
    "证明: $A\\mathbf{E}=A(\\mathbf{U}-\\hat{\\mathbf{U}})=\\mathbf{F}-(\\mathbf{F}+\\mathbf{\\tau})=-\\mathbf{\\tau}$.\n",
    "\n",
    "**定理7.18**:公式7.8中的有限差分方法被称为关于该边值问题是**适定的(consistent)** 如果\n",
    "$$\\lim\\limits_{h\\rightarrow 0}\\lVert \\mathbf{\\tau}^h\\rVert=0.$$\n",
    "\n",
    "**评论**: 对一个边值问题施加有限差分方法时,先不讨论收敛速度,我们希望至少通过加密网格可以让解逼近到真解上.当适定性条件没有满足时,随着网格加密,离散的算子都没有逼近到想要计算的方程上去,我们实际上在计算另一个问题!如何来得到一个正确的结果？\n",
    "\n",
    "适定性保证了我们在计算我们的问题,如果想要解能够收敛到真解,那还需要下一节中的要求."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "171bbccb",
   "metadata": {},
   "source": [
    "# 稳定性和收敛性\n",
    "**定义7.19**: 一个有限差方法被称为**收敛的(covergent)** 如果\n",
    "$$\\lim\\limits_{h\\rightarrow 0}\\lVert \\mathbf{E}^h\\rVert=0.\\tag{7.21}$$\n",
    "\n",
    "**定义7.20**: 一个有限差方法被称为**稳定的(stable)** 如果满足以下两个条件:\n",
    "1. $\\lim\\limits_{h\\rightarrow 0} A$可逆,\n",
    "2. $\\lim\\limits_{h\\rightarrow 0} \\lVert A^{-1}\\rVert=\\mathrm{O}(1).$\n",
    "\n",
    "**评论**:当我们加密网格时,稳定性的第一个条件保证了离散的线性系统是可解的,而第二个条件保证了解是有界的,不会算爆.\n",
    "\n",
    "**定理7.21**:一个适定并且稳定的有限差分方法是收敛的.\n",
    "\n",
    "证明: 由引理7.17我们有 $\\lim \\lVert \\mathbf{E}^h\\rVert\\leq \\lim \\lVert(A^h)^{-1}\\rVert\\lim\\lVert \\mathrm{\\tau}\\rVert\\leq C\\lim\\lVert\\mathbf{\\tau}^h\\rVert=0.$\n",
    "\n",
    "**评论7.6**:在后面的内容中,我们在2-范数和无穷范数下对稳定性进行分析."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14d73fe6",
   "metadata": {},
   "source": [
    "# 2-范数下的收敛性\n",
    "**定义7.22**:一个矩阵$A\\in\\mathbb{R}^{n\\times n}$的范数可以由向量范数导出,具体的定义为\n",
    "\\begin{align}\n",
    "\\lVert A\\rVert\n",
    "&=\\sup\\left\\{\\frac{\\lvert A\\mathbf{x}}{\\mathbf{x}}: \\mathbf{x}\\in\\mathbb{R}^n,x\\neq 0\\right\\}\\\\\n",
    "&=\\sup\\left\\{\\lVert A\\mathbf{x}\\rVert:\\lVert \\mathbf{x}\\rVert=1\\right\\}.\n",
    "\\end{align}\n",
    "\n",
    "**引理7.24**:（7.11）中的系数矩阵A的特征值$\\lambda_k$和它对应的特征向量$w_k$是\n",
    "$$\\lambda_k(A)=\\frac{4}{h^2}\\sin^2\\frac{k\\pi}{2(m+1)},\\tag{7.23}$$\n",
    "$$w_k,j=\\sin\\frac{jk\\pi}{m+1},$$\n",
    "其中$j,k=1,2,\\ldots,m.$\n",
    "\n",
    "证明:将特征向量和特征值代入式$Aw_k - \\lambda_k w_k$,并利用式\n",
    "$$\\sin(\\alpha) + \\sin(\\beta)=2\\sin(\\frac{\\alpha + \\beta}{2})\\cos(\\frac{\\alpha - \\beta}{2})$$\n",
    "简单计算得到.\n",
    "\n",
    "**定理7.25**: 例7.9中的有限差分方法在2-范数下是收敛的.\n",
    "\n",
    "证明: 因为矩阵$A$是对称阵,我们可以得到$\\lVert A\\rVert_2 = \\rho(A)$.由定理7.24我们有\n",
    "$$\\lim\\limits_{h\\rightarrow{0}}\\lVert A^{-1}\\rVert_2=\\lim\\limits_{h\\rightarrow 0}\\frac{1}{\\min \\lvert \\lambda_k(A)\\rvert}=\\lim\\limits_{h\\rightarrow 0}\\frac{h^2}{4\\sin^2\\frac{\\pi h}{2}}=\\frac{1}{\\pi}=\\mathrm{O}(1).$$\n",
    "由定义7.20,该方法是稳定的.同时因为我们的离散二阶导数是适定的,因此我们知方法是收敛的.\n",
    "\n",
    "**评论7.7**: 我们证明了方法在2范数下是收敛的,由矩阵q-范数的等价性我们可知方法在任一q-范数下都收敛.\n",
    "\n",
    "在定理7.25的证明中,我们有$\\lVert\\mathbf{E}^h\\rVert=\\lVert -A^{-1}\\mathbf{\\tau}\\rVert\\leq\\lVert A^{-1}\\rVert\\lVert\\mathbf{\\tau}\\rVert=\\mathrm{O}(1)\\mathrm{O}(h^2)$.因此我们知道方法有二阶收敛性.\n",
    "\n",
    "那误差关于无穷范数的收敛速度是多少呢？由q-范数的关系我们知道\n",
    "$$\\lVert \\mathbf{E}\\rVert_\\infty\\leq \\frac{1}{\\sqrt{h}}\\lVert\\mathbf{E}\\rVert_2=\\mathrm{O}(h^{3/2}),$$\n",
    "但等号会取到吗？我们可能取了一个太大的上界.这需要我们去讨论在无穷范数下$\\lVert A^{-1}\\rVert_\\infty$的大小.事实上,从后面的定理7.30我们可以知道在无穷范数下误差也有二阶收敛性."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "70107a6a",
   "metadata": {},
   "source": [
    "# 格林函数\n",
    "**定义7.26**: 对任意固定的$\\bar{x}\\in [0, 1]$, **格林函数** $G(x; \\bar{x})$ 是一个关于$x$的函数,且是方程\n",
    "$$\n",
    "\\left\\{\n",
    "\\begin{array}{l}\n",
    "u''(x)=\\delta(x-\\bar{x});\\\\\n",
    "u(0)=u(1)=0,\n",
    "\\end{array}\n",
    "\\right.\n",
    "\\tag{7.25}\n",
    "$$\n",
    "其中$\\delta(x-\\bar{x})$是定义5.40中的Dirac delta函数.\n",
    "\n",
    "**引理7.27**:求解方程(7.25)的格林函数的表达式为\n",
    "$$G(x;\\bar{x})=\n",
    "\\left\\{\n",
    "\\begin{array}{l}\n",
    "(\\bar{x} - 1)x,\\ x\\in [0, \\bar{x}],\\\\\n",
    "\\bar{x}(x - 1),\\ x\\in [\\bar{x}, 1].\\\\\n",
    "\\end{array}\n",
    "\\right.\n",
    "\\tag{7.26}\n",
    "$$\n",
    "\n",
    "证明:对任意固定的$\\xi$,我们有\n",
    "\\begin{align}\n",
    "\\int_{x_{0} - \\xi}^{x_{0} + \\xi}G''(x)\\mathrm{d}x\n",
    "&=\\int_{x_{0} - \\xi}^{x_{0} + \\xi}\\delta(x - \\bar{x})\\mathrm{d}x\\\\\n",
    "&=\\left\\{\n",
    "\\begin{array}{l l}\n",
    "0,& \\bar{x}\\notin(x_{0} - \\xi, x_{0} + \\xi),\\\\\n",
    "1,& \\bar{x}\\in(x_{0} - \\xi, x_{0} + \\xi).\\\\\n",
    "\\end{array}\n",
    "\\right.\n",
    "\\end{align}\n",
    "令$\\xi\\rightarrow 0$,由微积分基本定理我们有\n",
    "\\begin{align}\n",
    "&\\lim\\limits_{\\xi\\rightarrow 0} G'(x_0 + \\xi) - \\lim\\limits_{\\xi\\rightarrow 0} G'(x_0 - \\xi)\\\\\n",
    "=&\\left\\{\n",
    "\\begin{array}{l l}\n",
    "0,& \\mathrm{if}\\ x_0\\in (0, \\bar{x})\\cup (\\bar{x}, 1),\\\\\n",
    "1,& \\mathrm{if}\\ x_0=\\bar{x}.\\\\\n",
    "\\end{array}\n",
    "\\right.\n",
    "\\end{align}\n",
    "使用待定系数法,假设\n",
    "$$G(x; \\bar{x})=\n",
    "\\left\\{\n",
    "\\begin{array}{l l}\n",
    "ax + b,& x\\in[0, \\bar{x}],\\\\\n",
    "cx + d,& x\\in[\\bar{x}, 1]\\\\\n",
    "\\end{array}\n",
    "\\right.$$\n",
    "并将它代入上式并结合格林函数的连续性可以确定四个系数.\n",
    "\n",
    "**推论7.28**:线性边值问题\n",
    "$$\\left\\{\n",
    "\\begin{array}{l}\n",
    "u''(x)=c\\delta(x - \\bar{x})，\\\\\n",
    "u(0)=u(1)=0.\n",
    "\\end{array}\n",
    "\\right.$$\n",
    "是$u(x)=cG(x;\\bar{x})$.\n",
    "\n",
    "**评论**: 和偏微分方程中高维情况下的格林函数$G(\\mathbf{x}; \\bar{\\mathbf{x}})=\\Gamma(\\mathbf{x} - \\bar{\\mathbf{x}}) - \\phi^{\\bar{\\mathbf{x}}}(\\mathbf{x})$相同,满足方程(7.25),通过引入格林函数我们可以容易地得到迪利克雷边值问题的解.当然格林函数和问题的求解区域$\\Omega$有关,只在一些特殊的情形下我们才能得到它的表达式,在本节中考虑一维情形,这本身就是一个非常特殊且简单的情形.\n",
    "\n",
    "**评论**:理解格林函数的物理意义可以把问题区域看作是一个导体,在边界上设置导体接地(齐次迪利克雷边界条件),在内部$x$点处放置一个单位正点电荷,那么导体内部所产生的电势分布就是格林函数.从这个物理意义出发我们也可以容易地知道格林函数的对称性:$G(\\mathbf{x},\\mathbf{y})=G(\\mathbf{y},\\mathbf{x})$."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a2f9fd1b",
   "metadata": {},
   "source": [
    "# 无穷范数下的收敛性\n",
    "**引理7.29**: 对于(7.11)中的矩阵$A$,它的逆矩阵$B=A^{-1}$的元素有\n",
    "$$b_{ij}=-hG(x_i;x_j)=\n",
    "\\left\\{\n",
    "\\begin{array}{l l}\n",
    "-h(x_j - 1)x_i,& i\\leq j,\\\\\n",
    "-hx_j(x_i - 1),& i\\geq j.\n",
    "\\end{array}\n",
    "\\right.$$\n",
    "更具体地写,矩阵$B$为\n",
    "$$\n",
    "B=-h\n",
    "\\left[\n",
    "\\begin{array}{cccc}\n",
    "x_1(x_1 - 1)&x_1(x_2 - 1)&\\cdots&x_1(x_m - 1)\\\\\n",
    "x_1(x_2 - 1)&x_2(x_2 - 1)&\\cdots&x_2(x_m - 1)\\\\\n",
    "\\ddots&\\ddots&\\vdots&\\ddots\\\\\n",
    "x_1(x_m - 1)&x_2(x_m - 1)&\\cdots&x_m(x_m - 1)\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "**证明**:将矩阵$A$和矩阵$B$相乘即可.\n",
    "\n",
    "**评论7.8**:注意到$AB=I$按列向量写出来就有\n",
    "$$A[b_1,b_2,\\cdots,b_m]=[e_1,e_2,\\cdots,e_m].$$\n",
    "对每个下标$i$,我们实际上要求解方程$Ab_i=e_i$,这可以被看作是离散方程$-u''(x)=h\\delta(x - x_j)$.将格林函数$G(x;x_i)$的值填到向量$b_i$上就得到了$B$的表达式.(由于格林函数的离散二阶导数是精确的,计算所得结果也是精确值).\n",
    "\n",
    "**定理7.30**:$B=A^{-1}$的无穷范数满足\n",
    "$$\\lVert B\\rVert_{\\infty}=\\max\\limits_{1\\leq i\\leq m}\\sum\\limits_{j=1}^{m}\\lvert b_{ij}\\rvert\\leq 1.$$\n",
    "**证明**:\n",
    "\\begin{align}\n",
    "\\sum\\limits_{j=1}^{m}\\lvert b_{ij}\\rvert\n",
    "&=\\sum\\limits_{j=1}^{i}hx_j\\lvert x_i - 1\\rvert + \\sum\\limits_{i+1}^{m}hx_i\\lvert x_j - 1\\rvert\\\\\n",
    "&\\leq \\sum\\limits_{j=1}^{i}h \\left( \\frac{m}{m + 1}\\right)^2 + \\sum\\limits_{i+1}^{m} h\\left( \\frac{m}{m+1}\\right)^2\\\\\n",
    "&=mh\\left(\\frac{m}{m+1}\\right)^2=\\left(\\frac{m}{m+1}\\right)^3\\leq 1.\n",
    "\\end{align}\n",
    "\n",
    "**评论**:定理7.29证明了系数矩阵的可逆性,定理7.30证明了逆矩阵的无穷范数随着网格加密,阶数是$\\mathrm{O}(1)$的,从而得由定义7.20得到无穷范数意义下方法收敛,再结合截断误差是二阶,因此无穷范数下收敛阶数也是二阶.\n",
    "\n",
    "****"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "293fd773",
   "metadata": {},
   "source": [
    "# 基于格林函数的解\n",
    "\n",
    "**引理7.31**:假设$\\mathcal{L}$是一个可逆微分算子满足\n",
    "$$\\mathcal{L}u(x)=f(x).\\tag{7.30}$$\n",
    "那么我们有\n",
    "$$u(x)=\\int G(x;\\bar{x})f(\\bar{x})\\mathrm{d}\\bar{x}.\\tag{7.31}$$\n",
    "其中$G$是格林函数,满足\n",
    "$$\\mathcal{L}G(x;\\bar{x})=\\delta(x - \\bar{x}).\\tag{7.32}$$\n",
    "**证明**:\n",
    "对式(7.32)两端乘上$f(\\bar{x})$,关于$\\bar{x}$进行积分,我们有\n",
    "$$\\int\\mathcal{L}G(x;\\bar{x})f(\\bar{x})\\mathrm{d}\\bar{x}=\\int \\delta(x - \\bar{x})f(\\bar{x})\\mathrm{d}\\bar{x}=f(x).$$\n",
    "因此我们得到\n",
    "$$\\mathcal{L}\\int G(x;\\bar{x})f(\\bar{x})\\mathrm{d}\\bar{x}=f(x).$$\n",
    "从$\\mathcal{L}$的可逆性就得到了式(7.31).\n",
    "\n",
    "**评论**:我们可以利用格林公式来进行推导.\n",
    "对于方程\n",
    "$$u''(x)=f(x)\\ in\\ \\Omega:=(0, 1),\\tag{7.6}$$\n",
    "和边界条件\n",
    "$$u(0)=\\alpha,\\ u(1)=\\beta，\\tag{7.7}$$\n",
    "设$u$是它的解,取充分小的$\\epsilon$,使得$(x - \\xi,x + \\xi)$落在$[0, 1]$中.在区域$H=[(0,x - \\xi)\\cup(x + \\xi,1)$上积分我们有\n",
    "\\begin{align}\n",
    "\\int_{H} \\left[ u(\\bar{x})G''(x;\\bar{x}) - G(x;\\bar{x})u''(\\bar{x})\\mathrm{d}\\bar{x}\\right]\n",
    "=&\\left[-u(0)G'(x;0) + u(1)G'(x;1)\\right] - \\left[-G(x;0)u'(0) + G(x;1)u'(1)\\right]\\\\\n",
    "&+\\left[-u(x - \\epsilon)G'(x;x-\\epsilon) + u(x+\\epsilon)G'(x;x+\\epsilon)\\right]\\\\\n",
    "&- \\left[-G(x;x-\\epsilon)u'(x-\\epsilon) + G(x;x+\\epsilon)u'(x+\\epsilon)\\right]\\\\\n",
    "\\end{align}\n",
    "其中由于积分区域挖去了点$x$的邻域, $\\int_{H}u(\\bar{x})G''(x;\\bar{x})\\mathrm{d}\\bar{x}=0$,\n",
    "等式右端第一项由边界条件已知，第二项将格林函数表达式代入得到$-u(x)$,第三项由连续性会随$\\epsilon$减小而趋于$0$.\n",
    "因此我们有\n",
    "$$u(x)= \\int G(x;\\bar{x})f(\\bar{x})\\mathrm{d}\\bar{x} + \\left[\\alpha(1 - x) + \\beta x\\right].$$\n",
    "\n",
    "**定理7.32**:迪利克雷边值问题\n",
    "$$\n",
    "\\left\\{\n",
    "\\begin{array}{l}\n",
    "u''(x)=f(x),\\\\\n",
    "u(0)=\\alpha,u(1)=\\beta\\\\\n",
    "\\end{array}\n",
    "\\right.\\tag{7.33}$$\n",
    "的解是\n",
    "$$u(x)=\\alpha G_0(x) + \\beta G_1(x) + \\hat{U}(x),$$\n",
    "其中$G_0(x)$, $G_1(x)$和$\\hat{U}(x)$分别是以下边值问题的解:\n",
    "$$\\left\\{\n",
    "\\begin{array}{l}\n",
    "G_0''(x)=0,\\\\\n",
    "G_0(0)=1,u(1)=0\\\\\n",
    "\\end{array}\n",
    "\\right.\\Longrightarrow G_0(x)=1 - x,\\tag{7.35a}$$\n",
    "$$\\left\\{\n",
    "\\begin{array}{l}\n",
    "G_1''(x)=0,\\\\\n",
    "u(0)=0,u(1)=1\\\\\n",
    "\\end{array}\n",
    "\\right.\\Longrightarrow G_1(x)=x,\\tag{7.35b}$$\n",
    "$$\\left\\{\n",
    "\\begin{array}{l}\n",
    "\\hat{U}''(x)=f(x),\\\\\n",
    "\\hat{U}(0)=0,\\hat{U}(1)=0\\\\\n",
    "\\end{array}\n",
    "\\right.\\Longrightarrow \\hat{U}(x) = \\int_0^1 f(\\hat{x})G(x;\\bar{x})\\mathrm{d}\\bar{x}.\\tag{7.35c}$$\n",
    "\n",
    "**评论**:可以结合上一条评论从另一个角度来理解定理7.32.\n",
    "\n",
    "**评论7.10**:对于一个迪利克雷边值问题,我们需要考虑一个很重要的问题:当右端项或者边值上有扰动时,我们离散方法的解会如何变化?如果变化很大那因为机器误差的存在我们这个方法就不大靠谱.\n",
    "\n",
    "为了回答这个问题,我们对迪利克雷边值问题（7.33）进行离散\n",
    "$$A_g\\mathbf{U}_g=\\mathbf{F}_g$$\n",
    "我们将边值一同放入方程一同考虑,因此有\n",
    "$$A_g=\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccccc}\n",
    "h^2&0&&&\\\\\n",
    "1&-2&1&&\\\\\n",
    "&\\ddots&\\ddots&\\ddots&\\\\\n",
    "&&1&-2&1\\\\\n",
    "&&&0&h^2\\\\\n",
    "\\end{array}\n",
    "\\right],$$\n",
    "$$\\mathbf{U}_g=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "U_0\\\\\n",
    "\\mathbf{U}\\\\\n",
    "U_{m+1}\\\\\n",
    "\\end{array}\n",
    "\\right],\\\n",
    "\\mathbf{F}=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "f(x_1)\\\\\n",
    "\\vdots\\\\\n",
    "f(x_m)\\\\\n",
    "\\end{array}\n",
    "\\right],\\\n",
    "\\mathbf{F}_g=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "\\alpha\\\\\n",
    "\\mathbf{F}\\\\\n",
    "\\beta\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "从引理7.29我们知道系数矩阵$A$的逆矩阵是$B$,我们将矩阵$A_g$写成向量形式:\n",
    "$$A_g=\n",
    "\\left[\n",
    "\\begin{array}{ccc}\n",
    "&0&\\\\\n",
    "a_{g,0}&A&a_{g,m+1}\\\\\n",
    "&0&\\\\\n",
    "\\end{array}\n",
    "\\right]$$\n",
    "由此,我们得到$A_g$的逆矩阵$B_g$形如\n",
    "$$B_g=\n",
    "\\left[\n",
    "\\begin{array}{ccc}\n",
    "&0&\\\\\n",
    "b_{g,0}&B&b_{g,m+1}\\\\\n",
    "&0&\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "对离散方程那线性系统进行求解,我们有\n",
    "$$\\mathbf{U}_g=B_g\\mathbf{F}_g=\\alpha b_{g,0} + \\beta b_{g,m+1} + \n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "0\\\\\n",
    "B\\mathbf{F}\\\\\n",
    "0\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "\n",
    "首先$b_{g,0}$和$b_{g,m+1}$是由离散格式决定的,从定理7.32知这两列向量就是$G_0$和$G_1$在网格上的取值,因此这两项是$\\mathrm{O}(1)$的.定理7.29告诉了我们$B$的表达式,它的各个元素都是$\\mathrm{O}(h)$的.接下来我们考虑边值$\\alpha$和$\\beta$上的扰动以及右端项$\\mathbf{F}$上的扰动对计算结果的影响.\n",
    "   \n",
    "   - 当右端项$\\mathbf{F}$上有$\\mathrm{O}(h)$的扰动时,由于右端项被逆矩阵$B$作用,因此最终结果上会有$\\mathrm{O}(h^2)$的扰动.\n",
    "   - 当边值上有$\\mathrm{O}(h)$的扰动时,最终结果上会有$\\mathrm{O}(h)$的扰动.\n",
    "   \n",
    "更重要的是,当边值上有$\\mathrm{O}(1)$的扰动时,最终结果上会有$\\mathrm{O}(1)$的误差.当我们有边值的精确解时,那我们用精确解是最好的.但有时我们可能只能得到一个近似的边值,这个会在**整个**计算域内网格上的解上引人一个同阶的误差.   "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e8c3334",
   "metadata": {},
   "source": [
    "# 其他边值问题\n",
    "\n",
    "**例7.33**:考虑二阶边值问题\n",
    "$$u''(x)=f(x)\\ \\mathrm{in}(0, 1) \\tag{7.36}$$\n",
    "以及混合边界条件\n",
    "$$u'(0)=\\sigma,\\ u(1)=\\beta.\\tag{7.37}$$\n",
    "与之前纯迪利克雷边值问题的一个关键的差别在于,该问题下我们需要计算$x_0$上的未知量.\n",
    "\n",
    "- 第一种计算方法是使用单侧数据离散导数\n",
    "$$\\frac{U_1 - U_0}{h}=\\sigma \\tag{7.38}$$\n",
    "从而得到离散线性系统\n",
    "$$A_E\\mathbf{U}_E=\\mathbf{F}_E\\tag{7.39}$$\n",
    "其中\n",
    "$$A_E=\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccccc}\n",
    "-h&h&&&\\\\\n",
    "1&-2&1&&\\\\\n",
    "&\\ddots&\\ddots&\\ddots&\\\\\n",
    "&&1&-2&1\\\\\n",
    "&&&0&h^2\\\\\n",
    "\\end{array}\n",
    "\\right],$$\n",
    "$$\\mathbf{U}_E=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "U_0\\\\\n",
    "\\vdots\\\\\n",
    "U_{m+1}\\\\\n",
    "\\end{array}\n",
    "\\right],\\\n",
    "\\mathbf{F}_E=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "\\sigma \\\\\n",
    "f（x_1）\\\\\n",
    "\\vdots\\\\\n",
    "f(x_m)\\\\\n",
    "\\beta\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "在$x_0=0$处的截断误差为$\\mathrm{O}(h)$.\n",
    "- 第二种方法是使用一个虚拟单元将网格往外延伸一格至$x_{-1}=-h$,然后使用中心差分格式得到\n",
    "$$\\frac{U_1 - U_{-1}}{2h}=\\sigma \\tag{7.40}$$\n",
    "这样离散的截断误差为$O(h^2)$.\n",
    "但是我们并不知道$U_{-1}$的信息,因此我们在U_0上施加一个拉普拉斯算子来消去$U_1$:\n",
    "$$\\frac{1}{h^2}(U_{-1} - 2U_0 + U_1)=f(x_0).\\tag{7.41}$$\n",
    "因此我们有\n",
    "$$\\frac{1}{h}(-U_0 + U_1)=\\sigma + \\frac{h}{2}f(x_0).\\tag{7.42}$$\n",
    "这种方法得到的系数矩阵和(7.39)中的稀疏矩阵相同,除了$\\mathbf{F}_E$的第一个元素多了一项$\\frac{h}{2}f(x_0)$.\n",
    "\n",
    "- 第三种方法是使用$U_0$,$U_1$和$U_2$来得到一个$x_0$处一阶导数的二阶离散格式\n",
    "$$-\\frac{1}{h}(\\frac{3}{2}U_0 - 2U_1 + \\frac{1}{2}U_2)=\\sigma + O(h^2).\\tag{7.43}$$\n",
    "得到的线性系统为\n",
    "$$A_F\\mathbf{U}_E=\\mathbf{F}_E\\tag{7.44}$$\n",
    "其中\n",
    "$$A_F=\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccccc}\n",
    "-\\frac{3}{2}h&2h&-\\frac{1}{2}h&&\\\\\n",
    "1&-2&1&&\\\\\n",
    "&\\ddots&\\ddots&\\ddots&\\\\\n",
    "&&1&-2&1\\\\\n",
    "&&&0&h^2\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "\n",
    "**评论7.11**:在实现中,使用虚拟单元的方法会是一个好的选择,通过添加虚拟单元我们可以将网格数据填充,计算离散拉普拉斯和施加边界条件这三件事解耦,这便于我们替换离散求解器.\n",
    "\n",
    "**例7.35**:考虑二阶边值问题\n",
    "$$u''(x)=f(x)\\ \\mathrm{in}(0, 1) \\tag{7.45}$$\n",
    "以及纯纽曼边界条件\n",
    "$$u'(0)=\\sigma_0,\\ u'(1)=\\sigma_1.\\tag{7.46}$$\n",
    "为了保证解的存在性,边界条件需要满足\n",
    "$$\\int_0^1 f(x)\\mathrm{d}x=\\int_0^1 u''(x)\\mathrm{d}x=u'(1) - u'(0) = \\sigma_1 - \\sigma_0.\\tag{7.47}$$\n",
    "注意到方程的解加上任意常数仍是解.\n",
    "\n",
    "使用类似例7.33中的步骤,我们可以推导出离散格式\n",
    "$$A_F\\mathbf{U}_E=\\mathbf{F}_F\\tag{7.48}$$\n",
    "其中\n",
    "$$A_F=\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccccc}\n",
    "-h&h&&&\\\\\n",
    "1&-2&1&&\\\\\n",
    "&\\ddots&\\ddots&\\ddots&\\\\\n",
    "&&1&-2&1\\\\\n",
    "&&&h&-h\\\\\n",
    "\\end{array}\n",
    "\\right],\\tag{7.49}$$\n",
    "$$\\mathbf{F}_F=\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "\\sigma_0 + \\frac{h}{2}f(x_0）\\\\\n",
    "f(x_1) \\\\\n",
    "\\vdots\\\\\n",
    "f(x_{m})\\\\\n",
    "-\\sigma_1 + \\frac{h}{2}f(x_m + 1)\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "\n",
    "**引理7.36**:(7.49)中的系数矩阵$A_F$满足\n",
    "$$\\mathrm{dim}\\mathcal{N}(A_F)=1.\\tag{7.50}$$\n",
    "\n",
    "**证明**:显然$\\mathbf{e}=(1,\\cdots,1)^T$在$A_F$的零空间内.结合混合边界条件的系数矩阵可逆我们就完成了证明.\n",
    "\n",
    "**引理7.37**:(可解性条件)线性系统(7.48)有解当且仅当\n",
    "$$\\frac{h}{2}f(x_0) + h\\sum\\limits_i=1^m f(x_i) + \\frac{h}{2}f(x_{m+1})=\\sigma_1 - \\sigma_0.\\tag{7.51}$$\n",
    "\n",
    "**证明**:由代数基本定理我们有\n",
    "$$\\mathbb{R}^{m+2} = \\mathcal{R}(A_F)\\oplus \\mathcal{N}(A_F^T)\\tag{7.52}$$\n",
    "以及$\\mathrm{dim}\\mathcal{N}(A_F^T)=\\mathrm{dim}\\mathcal{N}(A_F)$.引理7.36告诉我们$\\mathrm{dim}\\mathcal{N}(A_F^T)=1$.我们有\n",
    "$$\\mathcal{N}(A_F^T)=\\mathrm{span}\\left\\{(1,h,h,\\cdots,h,1)^T\\right\\}.$$\n",
    "\n",
    "- 充分性,(7.51)满足时$\\mathbf{F}_F$和$\\mathcal{N}(A_F^T)$正交,由（7.52）得$\\mathbf{F}_F$落在$\\mathcal{R}(A_F)$中.因此线性系统有解.\n",
    "- 必要性,解的存在性说明$\\mathbf{F}_F\\in\\mathcal{R}(A_F)$,将(7.48)左端乘开后求和就得到了式(7.51).\n",
    "\n",
    "**评论7.13**:条件(7.51)就是离散意义下的(7.47).为了让(7.45)-(7.46)的方程解唯一,我们可以添加额外条件\n",
    "$$\\int_0^1 u(x)\\mathrm{d}x = 0.$$\n",
    "计算中施加一个离散下的该条件就可以给零空间减一维从而保证解的唯一性."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2463bd74",
   "metadata": {},
   "source": [
    "# 二维边值问题\n",
    "**例7.38**（单位正方形上泊松方程的有限差分方法）\n",
    "考虑$\\Omega:=(0, 1)^2$上的二维边值问题\n",
    "$$-\\frac{\\partial^2}{\\partial x^2}u(x, y) - \\frac{\\partial^2}{\\partial y^2}u(x, y) = f(x, y)\\tag{7.53}$$\n",
    "和齐次迪利克雷边界条件\n",
    "$$u(x, y)\\lvert_{\\partial \\Omega}=0.\\tag{7.54}$$\n",
    "计算域可以被均匀划分为\n",
    "$$x_i = ih.\\ y_j = jh,\\ i,j=1,2,\\ldots,m,\\tag{7.55}$$\n",
    "其中$h=\\Delta x=\\Delta y=\\frac{1}{m+1}$是网格宽度.\n",
    "\n",
    "我们对$\\frac{\\partial^2 u}{\\partial x^2}$和$\\frac{\\partial^2 u}{\\partial y^2}$分别施加离散,得到\n",
    "$$-\\frac{U_{i - 1,j} - 2U_{i,j} + U_{i+1,j}}{h^2} - \\frac{U_{i,j-1} - 2U_{i,j} + U_{i, j+1}}{h^2} = f_{i,j}.\\tag{7.56}$$\n",
    "最终我们得到一个有$m\\times m$个未知数的线性系统\n",
    "$$A_{2D}\\mathbf{U}=\\mathbf{F}.\\tag{7.57}$$\n",
    "\n",
    "**评论**:在二维情况下,一个点上的拉普拉斯算子的作用与它相邻的四个点有关,而当我们使用向量表示未知量时会用不止相邻两个的未知量,我们如何来对网格点编号会对系数矩阵$A_{2D}$的性质带来影响.这里我们使用最一般的编号方式即$\\mathrm{index}=i + m * j$.\n",
    "\n",
    "**例7.40**:对于m=3的情况,我们有\n",
    "$$\n",
    "A_{2D}=\n",
    "\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccccccccc}\n",
    "+4&-1&&-1&&&&&\\\\\n",
    "-1&+4&-1&&-1&&&&\\\\\n",
    "&-1&+4&&&-1&&&\\\\\n",
    "-1&&&+4&-1&&-1&&\\\\\n",
    "&-1&&-1&+4&-1&&-1&\\\\\n",
    "&&-1&&-1&+4&&&-1\\\\\n",
    "&&&-1&&&+4&-1&\\\\\n",
    "&&&&-1&&-1&+4&-1\\\\\n",
    "&&&&&-1&&-1&+4\\\\\n",
    "\\end{array}\n",
    "\\right]=\n",
    "\\frac{1}{h^2}\n",
    "\\left[\n",
    "\\begin{array}{ccc}\n",
    "T&-I&\\\\\n",
    "-I&T&-I\\\\\n",
    "&-I&T\\\\\n",
    "\\end{array}\n",
    "\\right],$$\n",
    "$$\\mathrm{U} = \n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "U_{11}\\\\\n",
    "U_{21}\\\\\n",
    "U_{31}\\\\\n",
    "U_{12}\\\\\n",
    "\\vdots\\\\\n",
    "U_{33}\\\\\n",
    "\\end{array}\n",
    "\\right],$$\n",
    "其中\n",
    "$$T=\n",
    "\\left[\n",
    "\\begin{array}{ccc}\n",
    "+4&-1&0\\\\\n",
    "-1&+4&-1\\\\\n",
    "0&-1&+4\\\\\n",
    "\\end{array}\n",
    "\\right].$$\n",
    "\n",
    "**引理7.41**:令全局误差为$\\mathbf{E}=\\mathbf{U}-\\hat{\\mathbf{U}}$.那么(7.58)的截断误差有\n",
    "$$A_{2D}\\mathbf{E}=-\\tau.\\tag{7.60}$$\n",
    "\n",
    "**评论7.15**:我们对$A_{2D}$并不满意,因为:\n",
    "   1. 系数矩阵$A_{2D}$和一维情况的系数矩阵$A$之间的关系并不清楚.\n",
    "   2. 一般情况下更高维的格式推导更加复杂.\n",
    "   3. 高维情况下进行稳定性和收敛性分析时更加困难.\n",
    "    \n",
    "这些问题可以通过寻找一维格式和多维格式之间的关系来解决."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b398bbab",
   "metadata": {},
   "source": [
    "# Kronecker乘积\n",
    "**定义7.42**:两个矩阵$A\\in\\mathbb{C}^{m\\times n}$和$B\\in\\mathbb{C}^{p\\times q}$的**Kronecker乘积**是一个矩阵$A\\otimes B\\in\\mathcal{C}^{mp\\times nq}$,具体元素为\n",
    "$$A\\otimes B=\n",
    "\\left[\n",
    "\\begin{array}{cccc}\n",
    "a_{11}B&a_{12}B&\\cdots&a_{1n}B\\\\\n",
    "a_{21}B&a_{22}B&\\cdots&a_{2n}B\\\\\n",
    "\\vdots&\\vdots&\\ddots&\\vdots\\\\\n",
    "a_{m1}B&a_{m2}B&\\cdots&a_{mn}B\\\\\n",
    "\\end{array}\n",
    "\\right],$$\n",
    "其中$a_{ij}$是$A$的第$(i,j)$个元素.\n",
    "\n",
    "**定义7.44**:对于矩阵$X\\in\\mathcal{C}^{m\\times n}$,$\\mathrm{vec}(X)$定义为一列大小为$mn$的向量,其中元素是由$X$中元素从左到右一列列拼接而成,即\n",
    "$$\\mathrm{vec}(X)_{i + (j - 1)\\times m} = x_{ij}.$$\n",
    "\n",
    "**引理7.45**:任何$A\\in \\mathbb{R}^{m\\times m}$，$B\\in\\mathbb{R}^{n\\times n}$以及$x\\in\\mathbb{R}^{m\\times n}$满足\n",
    "$$\\mathrm{vec}(AX)=(I_n\\otimes A)\\mathrm{vec}(X),\\tag{7.62}$$\n",
    "$$\\mathrm{vec}(XB)=(B^{T}\\otimes I_m)\\mathrm{vec}(X).\\tag{7.63}$$\n",
    "\n",
    "**证明**:我们有\n",
    "\\begin{align}\n",
    "\\mathrm{vec}(AX)\n",
    "&=\\mathrm{vec}(\\left[A\\mathbf{X}_1,A\\mathbf{X}_2,\\cdots,A\\mathbf{X}_n\\right])\\\\\n",
    "&=\\left[\n",
    "\\begin{array}{c}\n",
    "A\\mathbf{X}_1\\\\\n",
    "A\\mathbf{X}_2\\\\\n",
    "\\vdots\\\\\n",
    "A\\mathbf{X}_n\\\\\n",
    "\\end{array}\n",
    "\\right]=\n",
    "\\left[\n",
    "\\begin{array}{cccc}\n",
    "A&&&\\\\\n",
    "&A&&\\\\\n",
    "&&\\ddots&\\\\\n",
    "&&&A\\\\\n",
    "\\end{array}\n",
    "\\right]\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "\\mathbf{X}_1\\\\\n",
    "\\mathbf{X}_2\\\\\n",
    "\\vdots\\\\\n",
    "\\mathbf{X}_n\\\\\n",
    "\\end{array}\n",
    "\\right]\\\\\n",
    "&=(I_n\\otimes A)\n",
    "\\left[\n",
    "\\begin{array}{c}\n",
    "\\mathbf{X}_1\\\\\n",
    "\\mathbf{X}_2\\\\\n",
    "\\vdots\\\\\n",
    "\\mathbf{X}_n\\\\\n",
    "\\end{array}\n",
    "\\right].\\\\\n",
    "\\end{align}\n",
    "令$Y=XB$,我们有\n",
    "$$\\mathbf{Y}_j=X\\mathbf{b}_j\\Rightarrow y_{kj}=\\sum\\limits_{i=1}^n x_{ki}b_{ij}.\\tag{7.64}$$\n",
    "令$C=B^T\\otimes I_m$,它的第$(i,j)$个子块是\n",
    "$$C_{ij}=b_{ji}I_m.\\tag{7.65}$$\n",
    "令$D=C\\mathrm{vec}(X)$,那么$D$的第$j$个子块是\n",
    "$$\\mathbf{D}_j=\\sum\\limits_{i=1}^{n}C_{ji}\\mathbf{X}_i=\\sum\\limits_{i=1}^nb_{ij}I_m\\mathbf{X}_i=\\sum\\limits_{i=1}^nb_{ij}\\mathbf{X}_i,\\tag{7.66}$$\n",
    "$D$的第$(k,j)$个元素是\n",
    "$$d_{kj}=\\sum\\limits_{i=1}^n b_{ij}x_{ki}=\\sum\\limits_{i=1}^n x_{ki}b_{ij}.\\tag{7.67}$$\n",
    "结合(7.64)和(7.67)我们就得到了(7.63)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51028602",
   "metadata": {},
   "source": [
    "# 2-范数下的收敛性\n",
    "**引理7.46**:线性系统(7.57)等价于\n",
    "$$AU_{m\\times m} + U_{m\\times m}A=F_{m\\times m},\\tag{7.68}$$\n",
    "其中$U$的第$(i, j)$个元素是网格点$(i, j)$上的计算值,$F_{m\\times m}$的第$(i, j)$个元素是\n",
    "$$(F_{m\\times m})_{ij}=f(ih, jh),$$\n",
    "$A$是(7.11)中的一维离散拉普拉斯算子.\n",
    "\n",
    "**证明**: 将方程乘开即可.\n",
    "\n",
    "**评论**:在实际实现时我们不需要存储系数矩阵$A$的表达式,拉普拉斯算子实际是以作用的形式是实现的,式（7.68）中的左右乘$A$实际上就是$x$和$y$方向上作用离散二阶导数算子.\n",
    "\n",
    "**引理7.47**:(7.11)中的一维离散拉普拉斯算子$A$满足\n",
    "$$\\mathrm{vec}(AU_{m\\times m} + U_{m\\times m}A)=(I_m\\otimes A + A\\otimes I_m)\\mathrm{vec}(U_{m\\times m}).$$\n",
    "\n",
    "**证明**:将引理7.45作用到式(7.57)上并结合$A$的对称性就完成了证明.\n",
    "\n",
    "**定理7.48**:使用矩阵编号,线性系统(7.57)可以被写为\n",
    "$$A_{2D}=I_m\\otimes A + A\\otimes I_m,\\ \\mathbf{U}=\\mathrm{vec}(U_{m\\times m}),\\ \\mathbf{F}=\\mathrm{vec}(F_{m\\times m}).$$\n",
    "\n",
    "**定义7.49**:n维情况下的离散拉普拉斯算子是\n",
    "$$A_{nD}=\\sum_{j=0}^{n-1}\\overbrace{I_m\\otimes \\cdots\\otimes I_m}^{\\sharp I_m=j}\\otimes A\\otimes\\overbrace{I_m\\otimes \\cdots\\otimes I_m}^{\\sharp I_m=n - j - 1}.\\tag{7.70}$$\n",
    "\n",
    "**定理7.51**:$A_{2D}$的特征值和特征向量为\n",
    "$$\\lambda_{ij} = \\lambda_i + \\lambda_j,\\ \\mathbf{W}_{ij}=\\mathrm{vec}(\\mathbf{w}_i\\mathbf{w}_j^T).\\tag{7.11}$$\n",
    "其中$(\\lambda_i,\\mathbf{w}_i)$是$A$的一个特征值特征向量对.\n",
    "\n",
    "**证明**:引理7.24有\n",
    "\\begin{align}\n",
    "A\\mathbf{w}_{i}\\mathbf{w}_{j}^{T}\n",
    "&= \\lambda_{i}\\mathbf{w}_{i}\\mathbf{w}_{j}^T + \\mathbf{w}_{i}\\mathbf{w}_{j}^TA^T\\\\\n",
    "&= \\lambda_i\\mathbf{w}_i\\mathbf{w}_j^T + \\mathbf{w}_i\\left(A\\mathbf{w}_j\\right)^T\\\\\n",
    "&=\\lambda_i\\mathbf{w}_i\\mathbf{w}_j^T + \\lambda_j\\mathbf{w}_i\\mathbf{w}_j^T\\\\\n",
    "&=(\\lambda_i + \\lambda_j)\\mathbf{w}_i\\mathbf{w}_j^T.\n",
    "\\end{align}\n",
    "\n",
    "结合定理7.48和引理7.47我们有\n",
    "\\begin{align}\n",
    "A_{2D}\\mathrm{vec}\\left(\\mathbf{w}_i\\mathbf{w}_j^T\\right)\n",
    "&=\\left(I_m\\otimes A + A\\otimes I_m\\right)\\mathrm{vec}(\\mathbf{w}_i\\mathbf{w}_j^T)\\\\\n",
    "&= \\mathrm{vec}\\left(A(\\mathbf{w}_i\\mathbf{w}_j^T) + (\\mathbf{w}_i\\mathbf{w}_j^T)A\\right)\\\\\n",
    "&=(\\lambda_i + \\lambda_j)\\mathrm{vec}(\\mathbf{w}_i\\mathbf{w}_j^T),\n",
    "\\end{align}\n",
    "因此我们得到$(\\lambda_{ij},\\mathbf{W}_{ij})$是$A_{2D}$的一个特征值特征向量对.\n",
    "\n",
    "**定理7.52**:例7.38中的有限差分方法在2-范数意义下是二阶收敛的.\n",
    "\n",
    "**证明**:因为$A_{2D}$的对称性,我们知道$\\lVert A_{2D}\\rVert_2=\\rho(A_{2D})$.由定理7.51我们有\n",
    "$$\\lim\\limits_{h\\rightarrow 0}\\lVert A_{2D}^{-1}\\rVert_2=\\lim\\limits_{h\\rightarrow 0}\\frac{1}{\\min \\lvert \\lambda_{ij}\\rvert}=\\lim\\limits_{h\\rightarrow 0}\\frac{h^2}{8\\sin^2\\frac{\\pi h}{2}} = \\frac{1}{2\\pi^2}=\\mathrm{O}(1).$$\n",
    "由定理7.20我们知该方法是稳定的.结合(7.58),定义7.18,定理7.21和引理7.41我们就完成了证明."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86269dd8",
   "metadata": {},
   "source": [
    "# 无穷范数下的收敛性\n",
    "**定理7.52**:例7.38中的有限差分方法在无穷范数意义下是收敛的.\n",
    "\n",
    "**证明**:我们定义一个比较函数$\\phi$:\n",
    "$$\\phi(x,y):=\\left(x - \\frac{1}{2}\\right)^2 + \\left(y - \\frac{1}{2}\\right)^2\\tag{7.72}$$\n",
    "并记$\\phi_{i,j}=\\phi(ih, jh)$.从例7.38知,$A_{2D}$可以被表示为算子作用的形式:\n",
    "$$A_{2D}U_{i,j}:=(A_{2D}\\mathbf{U})_{i,j}=\\frac{1}{h^2}(4U_{i,j} - U_{i - 1, j} - U_{i + 1, j} - U_{i, j - 1} - U_{i, j + 1})\\tag{7.73}$$\n",
    "由引理7.16,我们有\n",
    "$$A_{2D}\\phi(ih, jh) = \\tau(ih, jh) + f(ih, jh).$$\n",
    "其中由于$\\phi$是个二次函数,截断误差$\\tau\\equiv 0$,我们有\n",
    "$$f(ih, jh)=-\\frac{\\partial^2 \\phi(ih, jh)}{\\partial x^2} - \\frac{\\partial^2 \\phi(ih, jh)}{\\partial y^2}\\equiv -4.$$\n",
    "因此我们得到线性系统\n",
    "$$A_{2D}\\phi_{i,j}=-4.\\tag{7.74}$$\n",
    "构造一个网格函数\n",
    "$$\\psi_{i,j}=E_{i,j} + \\frac{1}{4}\\tau_m\\phi_{i,j},\\tag{7.75}$$\n",
    "其中$\\tau_m := \\lVert \\tau\\rVert_{\\infty}$以及$E_{i,j}$是全局误差在网格点$(ih,jh)$上的取值.因此我们有\n",
    "$$A_{2D}\\psi_{i,j}=A_{2D}E_{i,j} + \\frac{1}{4}\\tau_mA_{2D}\\phi_{i,j}=-\\tau_{i,j} - \\tau_m\\leq 0.$$\n",
    "\n",
    "由式(7.73),$A_{2D}\\psi_{i,j}\\leq 0$暗示着$\\psi_{i,j}$的相邻四个网格点上的值$\\psi_{i - 1,j}$,$\\psi_{i + 1, j}$, $\\psi_{i,j - 1}$和$\\psi_{i,j+1}$中至少有一个比$\\psi_{i,j}$大.因此$\\psi$在离散点上的值在边界上取到最大值,因此存在一个常数$C$使得\n",
    "$$E_{i,j}\\leq \\psi_{i,j}\\leq \\frac{1}{8}\\tau_m<Ch^2,$$\n",
    "其中第二步是由于在边界上误差$E_{i,j}=0$以及$\\psi$最大值取到$1/2$.\n",
    "\n",
    "另一方面,我们取网格函数\n",
    "$$\\chi_{i,j}:=-E_{i,j} + \\frac{1}{4}\\tau_m\\phi_{i,j}\\tag{7.76}$$\n",
    "我们类似地有\n",
    "$$-E_{i,j}\\leq \\chi_{i,j}\\leq\\frac{1}{8}\\tau_m<Ch^2.$$\n",
    "\n",
    "因此我们得到了无穷范数意义下误差也是二阶收敛的.\n",
    "\n",
    "**评论7.17**:定理7.53的关键步骤在于是:\n",
    "   1. 定义一个连续的比较函数$\\phi$使得在整个计算域内非负,且$A_{2D}\\phi_{i,j}$为负值.\n",
    "   2. 使用比较函数$\\phi$来构造一个网格函数$\\psi$将全局误差$E_{i,j}$和截断误差的无穷范数$\\tau_m$联系起来.\n",
    "   3. 注意到离散拉普拉斯算子作用在函数$\\psi$上时结果恒负.\n",
    "   4. 推出$\\psi$在边界上取最大值.\n",
    "   5. 使用迪利克雷边界条件下误差在边界上为$0$来将全局误差的上界用$\\tau_m$来控制住.\n",
    "   6. 得到$E_{i,j}$的无穷范数的上界.\n",
    "   \n",
    "**评论**:这里就是在证明离散意义下的最大模原理，我们利用式$-\\Delta E = -\\tau$,把全局误差和截断误差都看作是一个连续函数的话,我们已知边界上的误差为$0$,我们由最大模原理知\n",
    "$$\\max\\limits_{\\bar{\\Omega}}\\lvert E\\rvert \\leq 0 + C\\sup\\limits_{\\Omega}\\lvert \\tau\\rvert,$$\n",
    "误差的上界就被截断误差所控制住.离散意义下的证明的关键一步在于当右端项小于等于$0$时中心点不为模板上唯一最大值点.连续意义下若右端项小于等于$0$,则计算域内要么为常数(f=0)要么由极值点上Hassen矩阵的半负定性知$-\\Delta u > 0$产生矛盾,从而我们知道最大值在边界上取到.二阶离散模板恰巧保持了这一性质,而考虑四阶离散模板,由于有模板中有负的系数,就没有这么好的性质了.\n",
    "   \n",
    "**符号4**:考虑在区域$\\Omega$上离散一个边值问题.记$\\mathbf{X}_{\\Omega}$是离散边值问题的点组成的集合(u取值的点).令$\\mathbf{X}_{\\partial\\Omega}$是边界点组成的集合,其中点$Q\\in\\mathbf{X}_{\\partial\\Omega}$满足\n",
    "   \n",
    "   - 边值问题不在$Q$上进行离散.\n",
    "   - $u(Q)$被施加迪利克雷边界条件.\n",
    "   - $Q$上的迪利克雷边界条件被用于离散某个点$P$上的边值问题.\n",
    "不失一般性,我们记$\\mathbf{X}=\\mathbf{X}_{\\Omega}\\cup \\mathbf{X}_{\\partial \\Omega}.$\n",
    "\n",
    "**引理7.55**:(离散最大模定理)假设一个边值问题经有限差分离散得到\n",
    "$$\\forall P\\in\\mathbf{X}_{\\Omega},\\ L_hU_P-f_P + g_P=0,\\tag{7.77}$$\n",
    "其中$f_P$是边值问题的右端项,$g_P$是所有不是迪利克雷边界条件的边值点,$L_h$和$\\mathbf{X}_{\\Omega}$满足\n",
    "    \n",
    "   1. (DMP-1) 对任意离散了边值问题的点$P\\in\\mathbf{X}_{\\Omega}$,$L_h$有以下形式\n",
    "   $$L_hU_P=c_PU_P - \\sum\\limits_{Q\\in Q_P}c_QU_Q,\\tag{7.78}$$\n",
    "   其中$Q_P\\subset \\mathbf{X}_{\\Omega}\\cup\\mathbf{X}_{\\partial\\Omega}$,$c_P>0$以及$c_Q>0$.(7.78)中的集合$\\{P\\}\\cup Q_P$被称作**P-模板**或者**P点上离散算子$A_{2D}$的模板**\n",
    "   2. (DMP-2) $\\forall P\\in\\mathbf{X}_{\\Omega}$, $c_P\\geq \\sum_{Q\\in Q_P}c_Q$\n",
    "   3. (DMP-3) $\\mathbf{X}_{\\Omega}$是连通的,即\n",
    "       $\\forall P_0,P_m\\in\\mathbf{X}_{\\Omega}$,$\\exists P_1,P_2,\\ldots,P_{m-1}$使得$\\forall r=1,2,\\ldots,m$有$P_r$落在$P_{r-1}$的模板中.\n",
    "   4. (DMP-4) (7.78)中至少有一个方程含有一个边值$U_Q$是被施加迪利克雷边界条件的.\n",
    "\n",
    "那么对任意满足以下条件的网格函数$\\psi:\\mathbf{X}\\rightarrow \\mathbb{R}$:\n",
    "$$\n",
    "\\left\\{\n",
    "\\begin{array}{l}\n",
    "\\max\\limits_{P\\in\\mathbf{X}}\\psi_P\\geq 0\\\\\n",
    "\\forall P\\in\\mathbf{X}_{\\Omega},\\ L_h\\psi_P\\leq 0,\\\\\n",
    "\\end{array}\n",
    "\\right.\n",
    "\\tag{7.80}\n",
    "$$\n",
    "我们有\n",
    "$$\\max\\limits_{P\\in\\mathbf{X}_{\\Omega}}\\psi_P\\leq \\max\\limits_{Q\\in\\mathbf{X}_{\\partial \\Omega}}\\psi_{\\Omega}.\\tag{7.81}$$\n",
    "\n",
    "**证明**:假设\n",
    "$$M_{\\Omega}:=\\max\\limits_{Q\\in\\mathbf{X}_{\\Omega}}\\psi_{Q}>M_{\\partial \\Omega}:=\\max\\limits_{Q\\in\\mathbf{X}_{\\partial \\Omega}}$$\n",
    "其中$\\psi$的最大值$M_{\\Omega}$在点$P$上取到,那么\n",
    "$$M_{\\Omega}=\\psi_P\\leq \\frac{1}{c_P}\\sum\\limits_{Q\\in Q_P}c_Q\\psi_Q\\leq \\frac{1}{c_P}\\sum\\limits_{Q\\in Q_P}c_QM_Q\\leq M_{\\Omega},\\tag{*}$$\n",
    "其中第一个不等式由函数$\\psi$的性质(7.80)和离散格式的性质(7.78)得到,而第二个不等式由$M_{\\Omega}$的定义得到,第三个等式由(DMP-2)得到.如果要($*$)中第二个$\\leq$成为$=$,那么需要要求对任意的$Q$都有$\\psi_Q=\\psi_P$.由(DMP-3)知在方程离散的网格点上$\\psi$都取值为$M_{\\Omega}$.结合(DMP-4)我们得到$M_{\\Omega}=M_{\\partial \\Omega}$,这和我们的假设相矛盾,因此我们完成了定理的证明.\n",
    "\n",
    "**定理7.57**:假设一个有限差分离散满足定理7.55中的条件(DMP-1,2,3,4).那么全局误差$E_P:=U_P - u(P)$会有上界:\n",
    "$$\\forall P \\in \\mathbf{X},\\ \\lvert E_P\\rvert \\leq T_{\\max}\\left(\\max\\limits_{Q\\in\\mathbf{X}_{\\partial \\Omega}}\\phi(Q)\\right),\\tag{7.83}$$\n",
    "其中$$T_{\\max}=\\max_{P\\in\\mathbf{X}_{\\Omega}}\\lvert T_P\\rvert$$，$T_P$是$P$点处的截断误差满足$L_hE_P=-T_P$,$\\phi:\\mathbf{X}\\rightarrow \\mathbb{R}$是一个非负网格函数满足\n",
    "$$\\forall P\\in\\mathbf{X}_{\\Omega},\\ L_h\\phi_P\\leq -1. \\tag{7.84}$$\n",
    "**证明**:\n",
    "定义\n",
    "$$\\psi_P:=E_P+T_{\\max}\\phi_P$$\n",
    "我们知道有\n",
    "$$L_h\\psi_P\\leq -T_P - T_{\\max}\\leq 0.$$\n",
    "而且我们有$\\max_{P\\in\\mathbf{X}}\\psi_P\\geq 0$因为$\\phi_P\\geq 0$以及$E_Q=0$对于任意$Q\\in\\mathbf{X}_{\\partial\\Omega}$.\n",
    "因此我们有\n",
    "$$E_P\\leq \\max_{P\\in\\mathbf{X}_{\\Omega}}(E_P + T_{\\max}\\phi_P)\\leq \\max_{Q\\in\\mathbf{X}_{\\partial\\Omega}}(E_Q + T_{\\max}\\phi_Q)=T_{\\max}\\max\\limits_{Q\\in\\mathbf{X}_{\\partial \\Omega}}(\\phi_Q),$$\n",
    "\n",
    "对$\\psi_P=-E_P + T_{\\max}\\phi_P$进行相同的讨论我们就得到了定理的结论."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b2469e57",
   "metadata": {},
   "source": [
    "# 不规则区域上的收敛性分析\n",
    "\n",
    "**例7.58**:考虑二维不规则区域内的边值问题\n",
    "$$-\\frac{\\partial^2}{\\partial x^2}u(x,y) - \\frac{\\partial^2}{\\partial y^2}u(x,y)=f(x,y).\\tag{7.85}$$\n",
    "![](IrregularDomain.png)\n",
    "\n",
    "当在不规则点$P$上进行离散时我们不能使用之前所使用的规则模板进行离散.我们可以考虑使用不规则离散模板即\n",
    "$$L_h U_P:=\\frac{(1 + \\theta)U_P - U_A - \\theta U_W}{\\frac{1}{2}\\theta(1 + \\theta)h^2} + \\frac{(1 + \\alpha)U_P - U_B - \\alpha U_S}{\\frac{1}{2}\\alpha(1 + \\alpha)h^2}.$$\n",
    "\n",
    "**定理7.60**:\n",
    "使用定理7.57中的符号,离散方程的点集$\\mathbf{X}_{\\Omega}$可以被分为\n",
    "$$\\mathbf{X}_{\\Omega} = \\mathbf{X}_1\\cup\\mathbf{X}_2,\\ \\mathbf{X}_1\\cup\\mathbf{X}_2=\\emptyset,$$\n",
    "非负函数$\\phi:\\mathbf{X}\\rightarrow \\mathbb{R}$满足\n",
    "$$\\forall P\\in\\mathbf{X}_1,\\ L_h\\phi_P\\leq -C_1<0;\\tag{7.87a}$$\n",
    "$$\\forall P\\in\\mathbf{X}_2,\\ L-h\\phi_P\\leq -C_2<0,\\tag{7.87b}$$\n",
    "截断误差满足\n",
    "$$\\forall P\\in\\mathbf{X}_1,\\ \\lvert T_P\\rvert<T_1;\\tag{7.88a}$$\n",
    "$$\\forall P\\in\\mathbf{X}_2,\\ \\lvert T_P\\rvert<T_2.\\tag{7.88b}$$\n",
    "那么计算误差$E_P:=U_P-u(P)$有上界\n",
    "$$\\forall P\\in\\mathbf{X},\\ \\lvert E_P\\rvert\\leq \\left(\\max\\limits_{Q\\in\\mathbf{X}_{\\partial \\Omega}}\\phi(Q)\\right)\\max\\limits_{P\\in\\mathbf{X}_{\\Omega}}\\left\\{\\frac{T_1}{C_1},\\frac{T_2}{C_2}\\right\\}$$\n",
    "\n",
    "**定理7.62**:\n",
    "例7.58中的离散方法在无穷范数下二阶收敛.\n",
    "\n",
    "**证明**:\n",
    "定义比较函数\n",
    "$$\n",
    "\\phi(x,y):=\n",
    "\\left\\{\n",
    "\\begin{array}{ll}\n",
    "F_1\\left[(x-p)^2 + (y - q)^2\\right]&\\mathrm{if}(x,y)\\in\\mathbf{X}_{\\Omega};\\\\\n",
    "F_1\\left[(x-p)^2 + (y - q)^2\\right] + F_2&\\mathrm{if}(x,y)\\in\\mathbf{X}_{\\partial \\Omega},\\\\\n",
    "\\end{array}\n",
    "\\right.\n",
    "$$\n",
    "其中$(p,q)$是$\\Omega$的几何中心,$F_1$和$F_2$是两个正常数.规则点和不规则点都在$\\mathbf{X}_{\\Omega}$中.它们的区别在于对于规则点$Q$,我们有\n",
    "$$L_h\\phi_Q=-4F_1$$\n",
    "而对于不规则点$P$,关于$U_A$的系数为\n",
    "$$-\\frac{2}{\\theta(1 + \\theta)h^2}<-\\frac{1}{h^2}$$\n",
    "其中$\\theta\\in(0,1)$.因此我们有\n",
    "$$L_h\\phi_P<-4F_1-\\frac{1}{h^2}F_2<-\\frac{1}{h^2}F_2.\\tag{7.89}$$\n",
    "\n",
    "由习题7.59我们知道规则点上的截断误差上界为$T_1=K_1 h^2$而不规则点上的截断误差上界$T_2=K_2 h$,由定理7.60我们有\n",
    "$$\\lvert E_P\\rvert\\leq (F_1R^2 + F_2)\\max\\left\\{ \\frac{K_1h^2}{4F_1},\\frac{K_2 h^3}{F_2}\\right\\},\\tag{7.90}$$\n",
    "其中$R$是$\\Omega$的几何中心到$\\Omega$中任意点距离的最大值.当我们选择$F_1/F_2=K_1/(4K_2h)$时$\\max$中的两项相同,我们有\n",
    "$$\\forall P\\in\\mathbf{X},\\ \\lvert E_P\\rvert\\leq \\frac{1}{4}K_1R^2 h^2 + K_2h^3$$\n",
    "\n",
    "**评论7.22**:在定理7.62的证明中,我们需要选取$\\frac{F_2}{F_1}=\\mathrm{O}(h)$来最小化无穷范数.这一选择带来的结果是,尽管边界上$\\phi_P$和内部$\\phi_Q$是同阶的,$L_h\\phi_P$比$L_h\\phi_Q$量级更大(低阶),这是因为不规则部分需要除去一个$h^2$.如果我们不在$\\phi$的表达式上添加$F_2$,我们有\n",
    "$$\\lvert E_P\\rvert \\leq (F_1R^2)\\max\\left\\{\\frac{K_1 h^2}{4F_1},\\frac{K_2 h}{4F_1}\\right\\},$$\n",
    "这样我们就无法得到想要的结果了.这里的一个关键区别在于连续情况下$\\Delta$不会涉及边界部分而$L_h$需要涉及边界点."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3db3d46d",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
